{ pkgs, ... }:
{

    home.packages = with pkgs; [
   	(python3.withPackages(ps: with ps; [ datetime requests ] ))
    ];

     programs.waybar = {
          enable = true;

     style = ''
     * {
    border: none;
    border-radius: 0;
    font-family: Terminus;
    font-weight: bold;
    font-size: 18px;
    min-height: 0;
}

#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#tray,
#workspaces,
#custom-weather,
#language {
	padding: 0px 10px;
    	background: #1e1e2e;
	margin-top: 0px;
    	margin-bottom: 1px;
}

/* Bar */

window#waybar {
	background: #11111b;
	color: #cdd6f4;
}

/* Workspaces */

#workspaces {
    border-radius: 10px;
    margin-left: 10px;
    padding-right: 0px;
    padding-left: 5px;
}

#workspaces button {
    padding: 5px;
    color: #313244;
    margin-right: 5px;
}

#workspaces button.active {
    color: #a6adc8;
}

#workspaces button.focused {
    color: #a6adc8;
    background: #eba0ac;
    border-radius: 10px;
}

#workspaces button.urgent {
    color: #11111b;
    background: #a6e3a1;
    border-radius: 10px;
}

#workspaces button:hover {
    background: #11111b;
    color: #cdd6f4;
    border-radius: 10px;
}

/* Clock */

#clock {
    	padding-right: 10px;
	margin-left: 15px;
	border-radius: 10px 0px 0px 10px;
}

#custom-weather {
	border-radius: 0px 10px 10px 0px;
	padding-left: 0px;
	font-size: 15px;
	color: #D3D3D3
}

/* Battery */

#battery {

	color: #80e57c;
	border-radius: 0px 10px 10px 0px;
	padding-right: 20px;
}

#battery.critical:not(.charging) {
	border-left: 0px;
    	border-right: 0px;
    	background-color: alpha( mix(@background , #ff5555 , 0.9) , 0.9);
	color: #000000;
}

/* Cpu/Mem/Temp */

#cpu {
	color: #f5c2e7;
	border-left: 0px;
    	border-right: 0px;
	border-radius: 10px 0px 0px 10px;
}

#memory {
	color: #f9e2af;
	border-left: 0px;
   	border-right: 0px;
}

#temperature {
	color: #89b4fa; 
	border-left: 0px;
    	border-right: 0px;

}

#temperature.critical {
	color: #ff5555;
	border-left: 0px;
    	border-right: 0px;
}

/* Network */

#network {
	color: #fab387;
	border-left: 0px;
    	border-right: 0px;
	padding-right: 20px;
}

#network.disconnected {
	color: #ff5555; 
	border-left: 0px;
    	border-right: 0px;
	padding-right: 18px
}

/* Pulseaudio */

#pulseaudio {
	color: #f2cdcd;
	border-left: 0px;
    	border-right: 0px;
}

#pulseaudio.muted {
	color: #ff5555;
	border-left: 0px;
    	border-right: 0px;
	padding-right: 15px;
}

/* Layout/Language */

#language {

}


/* Tray */

#tray {

	background-color: #313244;
	border-left: 0px;
    border-right: 0px;
    border-radius: 10px;
    margin-left: 10px;

}
     '';

     settings = [{
    "layer" = "top";
    "height" = 30;
    "spacing" = 4;
    
    modules-left = ["clock" "custom/weather"];
    modules-center = ["wlr/workspaces"];

    modules-right = ["cpu" "temperature" "memory" "pulseaudio" "network"
    	"keyboard-state" "battery" "tray"];


   "clock" = {
        "tooltip-format" = "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>";
	"format" = " {:%H:%M}";
        "format-alt" = "{:%Y-%m-%d}";
    };


   "custom/weather" = {
        "tooltip" = true;
        "format" = "{}";
        "exec" = "python ~/.config/nixos/modules/waybar/weather.py";
        "return-type" = "json";
	"interval" = 1800;
    };

   "wlr/workspaces" = {
     "format" = "{icon}";
     "on-scroll-up" = "hyprctl dispatch workspace e+1";
     "on-scroll-down" = "hyprctl dispatch workspace e-1";
     "on-click" = "activate";
     "all-outputs" = false;
    };


    "cpu" = {
        "format" = "{usage}% ";
	"interval" = 1;
    };

    "temperature" = {
        "critical-threshold" = 80;
        "format" = "{temperatureC}°C ";
        "format-critical" = "{temperatureC}°C "; 
	"interval" = 5;
    };


    "memory" = {
        "format" = "{used:0.1f}G ";
    };

    "pulseaudio" = {
	"format" = "{volume}% {icon}";

        "format-bluetooth" = "{volume}% ";
        "format-bluetooth-muted" = " ";
        "format-muted" = "";
        "format-icons" = {
            "headphone" = "";
            "hands-free" = "";
            "headset" = "";
            "phone" = "";
            "portable" = "";
            "car" = "";
            "default" = ["" "" ""];
        };
        "on-click" = "amixer set Master toggle";
    };

    "network" = {
        "format-wifi" = " {bandwidthDownBits} ";
        "tooltip-format" = "{ifname} via {gwaddr} 󰖩";
        "format-linked" = "{ifname} (No IP) 󰌷";
        "format-alt" = " {bandwidthUpBits} ";

	"interval" = 2;
    };

    "hyprland/language" = {
        "format" = "{short} ";
    };

    "battery" = {
        "states" = {
	   "warning" = 30;
            "critical" = 15;
        };
        "format" = "{capacity}% {icon}";
        
	"format-charging" = "{capacity}% ";
        "format-plugged" = "{capacity}% ";
        "format-alt" = "{time} {icon}";
        "format-icons" = ["" "" "" "" ""];
	"interval" = 10;
    };

    "wlr/mode" = {
        "format" = "<span style=\"italic\">{}</span>";
    };
    
    "tray" = {
        "spacing" = 10;
    };
     }];
   };
}
